<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
	<legend>{$page_name}</legend>
</fieldset>
<form action="{:url(request()->action())}" method="post">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
	<ul class="layui-tab-title">
		<li class="layui-this">基础信息</li>
		<li class="">内容详情</li>
		<li class="">SEO信息</li>
		{volist name="field_lists" id="vv"}
			<li class="">{$vv.name}</li>
		{/volist}
	</ul>
	<div class="layui-tab-content">
		<div class="layui-tab-item layui-show">
			<div class="layui-form">
				<div class="layui-form-item">
					<label class="layui-form-label">标题</label>
					<div class="layui-input-inline" style="width: 400px;">
						<input type="text" class="layui-input wy-type-input" name="title" value="{$info.title}" lay-verify="ver_input" placeholder="请输入标题">
					</div>
					<div class="layui-form-mid layui-word-aux">请输入标题</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">Banner图片</label>
					<div class="layui-input-inline">
						<input type="text" class="layui-input banner_input" name="banner" value="{$info.banner}" lay-verify="required" placeholder="请上传Banner图片">
					</div>
					<div class="layui-input-inline" style="width: auto;">
						<button type="button" class="layui-btn layui-btn-primary wy-upload" 
							id="banner_button"
							style="margin-bottom:0;"
							wy-data="{
								accept:'images',
								acceptMime:'image/*',
								exts: 'jpg|png|gif|bmp|jpeg',
								data:{savepath:'banner'},
								img_url:'.banner_img',
								input_url:'.banner_input'
							}">
							<i class="layui-icon layui-icon-upload"></i>上传图片
						</button>
					</div>
					
					<div class="layui-input-inline" style="width: auto;">
						<button type="button" class="layui-btn layui-btn-primary wy-work" 
							id="img_work"
							style="margin-bottom:0;"
							wy-data="{
								path:'banner',
								exts: 'jpg|png|gif|bmp|jpeg',
								img_url:'.banner_img',
								input_url:'.banner_input'
							}">
							<i class="layui-icon layui-icon-file"></i>文件空间
						</button>
					</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item" id="banner_show">
					<label class="layui-form-label"></label>
					<div class="layui-input-block" id="banner_show_div">
						<img src="{$info.banner|default=config('app.noimg')}" class="banner_img wy-uploads_img">
					</div>
				</div>
			
			
			
			
			</div>
		</div>
		<div class="layui-tab-item">
			<div class="layui-form">
				<div class="layui-form-pane">
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">详情</label>
						<div class="layui-input-block" style="border: 1px solid #CCCCCC;">
							<textarea name="content" class="layui-textarea wy-type-simple" id="wy_edit_content" lay-verify="ver_simple" placeholder="请输入详情" style="width: 100%;height:400px;" >{$info.content}</textarea>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-tab-item">
			<div class="layui-form">
				<div class="layui-form-item">
					<label class="layui-form-label">SEO标题</label>
					<div class="layui-input-inline" style="width: 400px;">
						<input type="text" class="layui-input wy-type-input" name="seo_title" value="{$info.seo_title}" lay-verify="ver_input" placeholder="请输入SEO标题">
					</div>
					<div class="layui-form-mid layui-word-aux">请输入SEO标题</div>
				</div>
				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">SEO关键词</label>
					<div class="layui-input-inline" style="width: 400px;">
						<textarea name="seo_keywords" class="layui-textarea wy-type-textarea" lay-verify="ver_textarea" placeholder="请输入SEO关键词">{$info.seo_keywords}</textarea>
					</div>
				</div>
				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">SEO描述</label>
					<div class="layui-input-inline" style="width: 400px;">
						<textarea name="seo_description" class="layui-textarea wy-type-textarea" lay-verify="ver_textarea" placeholder="请输入SEO描述">{$info.seo_description}</textarea>
					</div>
				</div>
			</div>
		</div>
		
		
		
		{volist name="field_lists" id="vv"}
			<div class="layui-tab-item">

				{volist name="vv.lists" id="vo"}
					<div class="layui-form-item">
						{switch vo['field_type'] }
							{case textarea}
								<!-- 文本域 -->
								<div class="layui-form-item layui-form-text">
									<label class="layui-form-label">{$vo.field_name}</label>
									<div class="layui-input-inline" style="width: 400px;">
										<textarea name="attr_content[{$vo.field}]" class="layui-textarea wy-type-textarea" lay-verify="ver_textarea" placeholder="请输入{$vo.field_name}">{$vo.value}</textarea>
									</div>
									{if $vo['field_tips']}
									<div class="layui-form-mid layui-word-aux">{$vo.field_tips}</div>
									{/if}
								</div>
							{/case}
							{case images}
								<!-- 上传按钮 -->
								<div class="layui-form-item">
									<label class="layui-form-label">{$vo.field_name}</label>
									<div class="layui-input-inline">
										<input type="text" class="layui-input attr_{$vo.field}_input" name="attr_content[{$vo.field}]" value="{$vo.value}" lay-verify="" placeholder="请上传{$vo.field_name}">
									</div>
									<div class="layui-input-inline" style="width: auto;">
										<button type="button" class="layui-btn layui-btn-primary wy-upload" 
											id="attr_{$vo.field}_button"
											style="margin-bottom:0;"
											wy-data="{
												accept:'images',
												acceptMime:'image/*',
												exts: 'jpg|png|gif|bmp|jpeg',
												data:{savepath:'attr_content'},
												img_url:'.attr_{$vo.field}_img',
												input_url:'.attr_{$vo.field}_input'
											}">
											<i class="layui-icon layui-icon-upload"></i>上传图片
										</button>
									</div>
									
									<div class="layui-input-inline" style="width: auto;">
										<button type="button" class="layui-btn layui-btn-primary wy-work" 
											id="attr_{$vo.field}_work"
											style="margin-bottom:0;"
											wy-data="{
												path:'attr_content',
												exts: 'jpg|png|gif|bmp|jpeg',
												img_url:'.attr_{$vo.field}_img',
												input_url:'.attr_{$vo.field}_input'
											}">
											<i class="layui-icon layui-icon-file"></i>文件空间
										</button>
									</div>
									{if ['field_tips']}
									<div class="layui-form-mid layui-word-aux">{$vo.field_tips}</div>
									{/if}
								</div>
								<div class="layui-form-item" id="attr_{$vo.field}_show">
									<label class="layui-form-label"></label>
									<div class="layui-input-block" id="attr_{$vo.field}_show_div">
										<img src="{$vo.value|default=config('app.noimg')}" class="attr_{$vo.field}_img wy-uploads_img">
									</div>
								</div>	
							{/case}
							{default /}
								<!-- 文本框 -->
								<div class="layui-form-item">
									<label class="layui-form-label">{$vo.field_name}</label>
									<div class="layui-input-inline" style="width: 400px;">
										<input type="text" class="layui-input wy-type-input" name="attr_content[{$vo.field}]" value="{$vo.value}" lay-verify="ver_input" placeholder="请输入{$vo.field_name}">
									</div>
									{if $vo['field_tips']}
									<div class="layui-form-mid layui-word-aux">{$vo.field_tips}</div>
									{/if}
								</div>
						{/switch}
					</div>
				{/volist}
		
			</div>
		{/volist}
		
	</div>
</div>
<div class="layui-form">
	<div class="layui-form-item">
		<div class="layui-input-block">
			<input name="id" type="hidden" value="{$info.id}">
			<button class="layui-btn" type="button"
					lay-submit
					lay-filter="wy-lists"
				>确认提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
		</div>
	</div>

</div>
</form>
<script>
var Kind_upload_json = "{:url('editor/kind_upload_json')}";
var Kind_file_manager_json = "{:url('editor/kind_file_manager_json')}";
</script>

<link href="{$public}kind_editor/themes/default/default.css{$version}" rel="stylesheet">
<script src="{$public}kind_editor/kindeditor-all.js{$version}"></script>
<script src="{$public}kind_editor/kind_editor_config.js{$version}"></script>

<script>
layui.use(['form','layer','element'], function(){
	var $		= layui.jquery,
		element = layui.element,
		$parent	= parent.layui.jquery,
		$top	= parent.parent.layui.jquery,
		layer	= layui.layer,
		parent_layer	= parent.layui.layer,
		top_layer		= parent.parent.layui.layer,
		form	= layui.form;

	form.on('submit(wy-lists)',function(data){

		var _this = $(this);
		_this.prop("disabled",true);
		var layer_tip = layer.load(1,{shade: [0.5,'#000']});
		var _form_action = _this.parents('form');
		$.post(
			_form_action.attr('action'),
			_form_action.serialize(),
			function(ret_data){
				_this.prop("disabled",false);
				if(ret_data['code'] == 1){
					layer.msg(
						ret_data.msg,
						{icon: 1,time: 2000},
						function(){
							// 刷新列表
							location.reload();
						}
					);
				}else{
					layer.msg(ret_data.msg,{icon: 2});
					layer.close(layer_tip);
				}
			},
			'JSON'
		);
	});
});
</script>
</body>